import {
  Column,
  PrimaryGeneratedColumn,
  CreateDateColumn,
  UpdateDateColumn,
  Unique
} from 'typeorm'
import { EntityModel } from '@midwayjs/orm'

@EntityModel('ie_user_token')
@Unique(['user_id'])
export class UserToken {

  @PrimaryGeneratedColumn()
  id: number;

  @Column({
    comment: '用户id',
    length: 60
  })
  user_id: string;

  @Column({
    comment: 'token'
  })
  token: string;

  @Column({
    comment: '类型 1:web+h5 2:wx小程序 3:ios 4:android',
    type: 'smallint',
    default: 1
  })
  type: number;

  @CreateDateColumn({
    comment: '创建时间'
  })
  create_at: Date;

  @UpdateDateColumn({
    comment: '更新时间'
  })
  update_at: Date;
}
